home *** CD-ROM | disk | FTP | other *** search
- /*
- DNothing.c
-
- Template for a Dragon plug-in "subspecies." Performs as advertised ╤ it don't do a thang!
-
- To make a new dragon named MyDragon ╤
-
- 1. Make a copy of Nothing.╣ and rename it MyDragon.╣
- 2. Make a copy of Nothing.╣.rsrc and rename it MyDragon.╣.rsrc
- 3. Open the MyDragon.╣ project and this file (DNothing.c)
- 4. Save this file as DMyDragon.c (this will change "DNothing.c" in the project
- window to "DMyDragon.c") ╤ you won't need a header file for your dragon class
- 5. Change all occurrences of "DNothing" in this file to "DMyDragon"
-
- To write and debug your dragon ╤
-
- 1. Make a file with some 'alis' resources in it by dragging-and-dropping some files
- onto the "'alis' Maker" dragon ╤ you'll need this to debug your dragon
- 2. Read the source code ╤ it'll be much easier to understand what's going on!
- => 3. Rewrite the DMyDragon::ProcessDroppings method so that it does what you
- want it to do ╤ this is the heart of the finished application
- 4. Things are set up (in Options╔) to use the precompiled file "PreDragon" ╤ so
- don't trash or rename it unless you change the preprocessor directives there
- ╤ or then you'll need to make your own precompiled headers file (try editing
- PreDragon.c and recreating PreDragon) or #include a few files, like
- <AppleEvents.h> and <Files.h>, in Dragon.c and elsewhere
- 5. Choose "Run" from the "Project" menu. When it's ready to go, set a breakpoint
- at the beginning of your dragon's ProcessDroppings method, then "Go."
- (There'll be an empty source window and the current function box will say
- "Dragon.debug.╣". Bring up the project window, open the DMyDragon.c file,
- and choose "Debug" from the "Source" menu.)
- 6. Use the StandardGetFile dialog that appears to choose the 'alis' resources file
- that you made earlier. Step through your ProcessDroppings and affiliated code,
- debug, etc.
- 7. To get a better look at what's happening inside the Dragon class's methods:
- a. Remove Dragon.debug.╣ from the MyDragon.╣ project file
- b. Add the files and libraries that comprise Dragon.debug.╣ (Dragon.c,
- FileUtils.c, HandleUtils.c, MacTraps, Main.c, and oops) to the project file
- c. Add "#define DEBUG" to the project prefix (choose "Options╔" under the
- "Edit" menu to get there)
- Then run the project ╤ this'll let you step through the Dragon.debug.╣ code
-
- To build the final dragon application ╤
-
- 1. Remove Dragonsmith.debug.╣ (or the files and libraries that it's comprised of)
- from the project file and add Dragonsmith.╣ in its (or their) place
- 2. Change the project's partition size (choose Set Project Type╔ from the Project
- menu) ╤ because of the way the THINK C Debugger works, the finished dragon
- won't need as much memory as it did while debugging
- 3. You'll probably want to make a few changes in the Nothing.╣.rsrc file ╤
-
- 'BNDL' 128 ResEdit v2.1 or higher is great for editing the various
- "utility" resources ╤ 'BNDL', 'FREF', 'ICN#', etc.
- 'FREF' Specify what kinds of things can be dropped on your dragon
- (the way I have Nothing.╣.rsrc set up, the user can drag-
- and-drop anything ╤ files, folders, disks ╤ on it)
- 'Drgn' 0 Put your copyright notice here
- 'ICN#' etc. Default icons are provided if you want to use them
- 'TEXT',
- 'styl' 128 These 2 hold styled text for the balloon help for your dragon's
- icon in the Finder. Leave the 'hfdr' resource alone if you
- want to use these resources; otherwise it won't work╔
- 'vers' Change these to fit your version number, etc.
- 'MoMa' 128 Number of times to call MoreMasters for more master pointers
- (this will generally be very low, like 3 or 4 ╤ the method
- Dragon::CallMoreMasters in Dragon.c is where I use this)
-
- 4. Choose "Build Application╔" from the "Project" menu, check the "Smart Link" box
- in the dialog that comes up, and cross your fingers!
-
- NOTE: You should set the "Stationery aware" SIZE bit for any dragon that doesn't actually
- alter anything that's dropped on it ╤ we don't want the Finder to think it has to
- make a copy of a stationery file before we get to see it! This should be done within
- THINK C ╤ some weirdness has been known to happen when there's a 'SIZE'
- resource in the project resource file (or maybe it was just me ╔ )
-
- Created 24 Apr 1992 Template file with instructions
- Modified 30 Apr 1992 Minor modifications in instructions
- 05 May 1992 More of the same
- 17 May 1992 Better, more detailed instructions to (hopefully) minimize confusion
-
- Copyright ⌐ 1992 by Paul M. Hoffman
- Send feedback to paul.hoffman@um.cc.umich.edu
-
- This code may be freely used, altered, and distributed in any way you want as long as:
- 1. It is GIVEN away rather than sold;
- 2. This statement and the above copyright notice are left intact.
-
- */
-
- #include "Dragon.h"
-
- class DNothing: Dragon {
-
- public:
- virtual OSErr ProcessDroppings (FSSpec **docs, long numDocs);
-
- };
-
- OSErr DNothing::ProcessDroppings (FSSpec **docs, long numDocs)
- {
- // If you want your dragon to do anything, you must override this method
- // Do whatever you want here, but make sure you leave an inherited:: call
- // somewhere in this method (probably at or near the end) ╤ it'll call
- // DisposHandle (docs). (Actually, this isn't really necessary if the
- // dragon doesn't hang around after ProcessDroppings.)
-
- return inherited::ProcessDroppings (docs, numDocs);
- }
-
- Dragon *CreateGDragon (void)
- {
- // (This function is declared in Dragon.h)
- // If you want your dragon to do anything, you must change this function
- // so that it returns an instance of your dragon class ╤ forgetting to
- // do this is an easy way to get totally frustrated!
-
- return (Dragon *) new DNothing;
- }